package com.mobi.cacti.rabbit.response;

import java.util.ArrayList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import android.util.Log;

public class ReqTicketRecentHandler extends DefaultHandler{
	
	private String tempVal;
	private ReqTicketRecent oClass;
	private ArrayList<ReqTicketRecent> reqTicketRecentList;
	

	public ArrayList<ReqTicketRecent> getObj() {
		return reqTicketRecentList;
	}
	
	public void startElement(String uri, String localName, String qName,Attributes attributes) throws SAXException {
		tempVal = "";
		
		Log.i("tai",">>>" + localName);
		
		if (localName.equalsIgnoreCase("ReqTFASTicketListRecent")) {
			reqTicketRecentList = new ArrayList<ReqTicketRecent>();
		}
		else if (localName.equalsIgnoreCase("Ticket_No")) {
			oClass = new ReqTicketRecent();
			oClass.ticketId = attributes.getValue("id");
		}
		
		
	}

	public void characters(char[] ch, int start, int length) throws SAXException {
		tempVal = new String(ch, start, length);
	}

	public void endElement(String uri, String localName, String qName) throws SAXException 
	{
		Log.i("tai",">>>" + qName);
		
		if (qName.equalsIgnoreCase("Read_Status")){
			oClass.readStatus = tempVal;
		}
		else if (qName.equalsIgnoreCase("Ticket_No")){
			if(!oClass.ticketId.equalsIgnoreCase("") && oClass.ticketId != null)
				reqTicketRecentList.add(oClass);
		}
	}

}
